package com.my.model.entity;

import com.my.model.extra.StudentInfo;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.handler.Fastjson2TypeHandler;
import com.mybatisflex.core.handler.JacksonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

import static com.mybatisflex.core.constant.FuncName.CURRENT_TIMESTAMP;

/**
 * @author mars
 * @date 2024-12-25 11:12
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table("student")
public class Student {
    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    private Long id;
    /**
     * 姓名
     */
    private String name;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 爱好
     */
    @Column(typeHandler = Fastjson2TypeHandler.class)
    private List<String> hobbies;
    /**
     * 信息
     */
    @Column(typeHandler = Fastjson2TypeHandler.class)
    private StudentInfo info;

    @Column(isLogicDelete = true)
    private Integer deleted;

    @Column(onInsertValue = CURRENT_TIMESTAMP)
    private LocalDateTime createTime;

    @Column(onUpdateValue = CURRENT_TIMESTAMP)
    private LocalDateTime UpdateTime;
}
